from django.db import models


class College(models.Model):
    college_name = models.CharField(max_length=122, verbose_name='')
    class Meta:
        db_table = 'college'

# Create your models here.
class Famous_Teacher(models.Model):
    teacher_name = models.CharField(max_length=122, verbose_name='教师姓名')
    teacher_position = models.CharField(max_length=122, verbose_name='教师职位')
    teacher_introduce = models.CharField(max_length=322, verbose_name='教师简介')
    teacher_image = models.URLField(verbose_name='教师照片', null=True, default='https://ww3.sinaimg.cn/mw690/008AB0ukgy1huql1brukij31dz1dzwf4.jpg')
    teacher_skill = models.CharField(max_length=122, verbose_name='教师技能')
    college_name = models.ForeignKey(College, verbose_name='学院名称·', on_delete=models.CASCADE)
    class Meta:
        db_table = 'famous_teacher'

class Profession(models.Model):
    name = models.CharField(max_length=50,verbose_name='专业名字')
    profession_location = models.TextField(verbose_name='专业定位')
    profession_profile=models.TextField(verbose_name='专业简介')
    profession_course=models.TextField(verbose_name='专业课程')
    profession_image=models.ImageField(verbose_name='专业首页图片')
    profession_image_text=models.CharField(max_length=123,verbose_name='首页图片标语')
    profession_Forkey=models.OneToOneField(College,verbose_name='专业名字',on_delete=models.CASCADE)

    class Meta:
        db_table = 'profession'
class Profession_img(models.Model):
    imgurl=models.ImageField(verbose_name='专业轮播图')
    class Meta:
        db_table = 'profession_img'

class Major(models.Model):
    name = models.CharField(max_length=100)

    class Meta:
        db_table = 'major'


class Student(models.Model):
    name = models.CharField(max_length=100)
    salary = models.IntegerField(default=0)
    major = models.ForeignKey(
        Major,
        on_delete=models.SET_NULL,
        null=True,
        blank=True,
        verbose_name="所属专业"
    )
    photo = models.ImageField(
        upload_to='student_photos/',
        blank=True,
        null=True,
        verbose_name="学生照片"
    )
    company = models.CharField(max_length=100, blank=True, verbose_name="就业公司")

    class Meta:
        db_table = 'student'


class CarouselImage(models.Model):
    photo = models.ImageField(upload_to='carousel_photos/',
                              blank=True,
                              null=True,
                              verbose_name="轮播图")

    class Meta:
        db_table = 'carousel_image'

class Users(models.Model):
    username = models.CharField(max_length=50)
    password = models.CharField(max_length=256)
    phone = models.CharField(max_length=50,null=True,blank=True)
    user_type = models.IntegerField(
        default=0,
        choices=[(0, '普通用户'), (1, '管理员')]
    )
    user_image = models.ImageField(default='https://ts1.tc.mm.bing.net/th/id/R-C.a0d674aaf2bea44d64703b570864dc7a?rik=U4G5G3GAcGJjNA&riu=http%3a%2f%2fwx3.sinaimg.cn%2flarge%2f006i487Uly1ff1bpq54i6j304u04s749.jpg&ehk=rskfhnxaK6ySmoD0TyzvJ5FuhC4u85hxccMOc7fgOxg%3d&risl=&pid=ImgRaw&r=0',max_length=255)
    class Meta:
        db_table = 'users'

class TemplateQuestionnaire(models.Model):
    title = models.CharField(max_length=200)
    category = models.CharField(max_length=100)

    def __str__(self):
        return self.title

